import request from "@/utils/request";

// 微信小程序一键登录
export function wxMiniLogin(phoneCode: string, loginCode: string) {
  const data = {
    phoneCode,
    loginCode,
  };
  return request({
    url: "/member/auth/weixin-mini-app-login",
    headers: {
      isToken: false,
    },
    method: "POST",
    data: data,
  });
}

/**
 * 登录接口
 * @param { 用户名、密码 } data
 * @returns
 */
export function login(data: any) {
  return request({
    url: "/kukeadmin/wechat/user/login",
    headers: {
      isToken: false,
    },
    method: "POST",
    data: data,
  });
}

/**
 * 验证码登录接口
 * @param { 用户名、验证码 } data
 * @returns
 */
export function verificationLogin(data: any) {
  return request({
    url: "/kukeadmin/wechat/user/smsLogin",
    headers: {
      isToken: false,
    },
    method: "POST",
    data: data,
  });
}

/**
 * 获取验证码接口
 * @param
 * @returns
 */
export function getVerificationCode(mobile: string) {
  return request({
    url: "/kukeadmin/wechat/user/sendSmsCode",
    headers: {
      isToken: false,
    },
    method: "POST",
    data: { mobile },
  });
}

/**
 * 获取当前登录者的信息
 * @returns Object
 */
export function getInfo() {
  return request({
    url: "/kukeadmin/user/getAdminUserInfoProt",
    method: "POST",
  });
}

/**
 * 退出登陆
 * @returns Promise<any>
 */
export function logoutProt() {
  return request({
    url: "/kukeadmin/user/logoutProt",
    method: "POST",
  });
}
